using System;
public partial class Controls_PatientBanner : System.Web.UI.UserControl
{
    private const string defaultValue = "Unknown";
    protected void Page_Load(object sender, EventArgs e)
    {
        //Set Address
        LabelAddressValue.Text = Address();

        //Set FullName
        if (!string.IsNullOrEmpty(this.FirstName))
        {
            LabelFirstname.Text = this.FirstName.Trim();
        }
        if (!string.IsNullOrEmpty(this.LastName))
        {
            LabelLastName.Text = this.LastName.ToUpper().Trim() + this.Delimiter;
        }
        if (!string.IsNullOrEmpty(this.MiddleName))
        {
            LabelMiddleName.Text = this.MiddleName.Trim();
        }

        //Set Gender
        if (!string.IsNullOrEmpty(this.Gender))
        {
            LabelGenderValue.Text = this.Gender.Trim();
        }
        else
        {
            LabelGenderValue.Text = defaultValue;
        }

        //Set Year of Birth
        if (!string.IsNullOrEmpty(this.YearOfBirth))
        {
            LabelYearOfBirthValue.Text = this.YearOfBirth.Trim();
        }
        else
        {
            LabelYearOfBirthValue.Text = defaultValue;
        }

        //Set Image
        ImagePersonalImage.ImageUrl = this.ImagePath;
    }
    public string ImagePath
    {
        get { return ViewStateString(ViewState["ImagePath"]); }
        set { ViewState["ImagePath"] = value; }
    }
    public string YearOfBirth
    {
        get { return ViewStateString(ViewState["YearOfBirth"]); }
        set { ViewState["YearOfBirth"] = value; }
    }
    public string FirstName
    {
        get { return ViewStateString(ViewState["FirstName"]); }
        set { ViewState["FirstName"] = value; }
    }
    public string LastName
    {
        get { return ViewStateString(ViewState["LastName"]); }
        set { ViewState["LastName"] = value; }
    }
    public string MiddleName
    {
        get { return ViewStateString(ViewState["MiddleName"]); }
        set { ViewState["MiddleName"] = value; }
    }

    public string Gender
    {
        get
        { return ViewStateString(ViewState["Gender"]); }
        set
        { ViewState["Gender"] = value; }
    }
    public string City
    {
        get { return ViewStateString(ViewState["City"]);}
        set { ViewState["City"] = value; }
    }

    public string State
    {
        get { return ViewStateString(ViewState["State"]); }
        set { ViewState["State"] = value; }
    }
    public string Country
    {
        get { return ViewStateString(ViewState["Country"]); }
        set { ViewState["Country"] = value; }
    }
    public string Delimiter
    {
        get { return ViewStateString(ViewState["Delimiter"]); }
        set { ViewState["Delimiter"] = value; }
    }
    private string Address()
    {
        string address = string.Empty;
        if (!string.IsNullOrEmpty(this.City) || !string.IsNullOrEmpty(this.State) || !string.IsNullOrEmpty(this.Country))
        {
            address = string.Format("{0}{1} {2}{1} {3}", City, Delimiter, State, Country);
        }
        else
        {
            address = defaultValue;
        }
        return address;
    }
    private string ViewStateString(object viewState)
    {
        return viewState.ToString().Trim();
    }
}